﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SoonCode.FocusTest.Models;
using SoonCode.FocusTest.ViewModels;

namespace SoonCode.FocusTest.Views
{
    /// <summary>
    /// MemberList.xaml 的交互逻辑
    /// </summary>
    public partial class MemberList : UserControl
    {
        public MemberList()
        {
            InitializeComponent();
        }

        private void MyGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            MemberListViewModel model = (MemberListViewModel)this.DataContext;
            model.SelectedMember.Clear();
            foreach (var selectedItem in myGrid.SelectedItems)
            {
                model.SelectedMember.Add((MemberInfo)selectedItem);
            }
        }

        private void OkButton_OnClick(object sender, RoutedEventArgs e)
        {
            MyGrid_OnMouseDoubleClick(sender, null);
        }
    }
}
